<div class="HelpDiv">
	<div class="HelpDivHead">
		<div class="HelpTitle">Socket通信</div>
		<div class="HelpMenu">
		  <div><a href="#Reception">前端</a></div>
		  <div><a href="#Backstage">后端</a></div>
		</div>
	</div>

	<div class="HelpBody">
		<div>
			<div id="Reception" class="HelpBodyBig">前端</div>
			<div class="HelpBodyMiddle">依赖“PublicSocket”模块，当第一次页面引用时会自动创建实例，后续页面访问不再创建，直到离开本站点</div>
			<br>
			<div class="HelpBodyMiddle"><b>方法</b></div>
			<div class="HelpBodyMiddle">on(eventName, callback)，注册监听接收消息</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">eventName</div>
				<div>监听事件名</div>
			</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">callback(data)</div>
				<div>接收消息的回调方法</div>
			</div>
			<div class="HelpBodyMiddle">emit(eventName, data)，基础方法，发送消息</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">eventName</div>
				<div>事件名</div>
			</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">data</div>
				<div>发送数据</div>
			</div>
			<div class="HelpBodyMiddle">toSelf(eventName, data)，发送消息给自己</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">eventName</div>
				<div>事件名</div>
			</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">data</div>
				<div>发送数据</div>
			</div>
			<div class="HelpBodyMiddle">toOther(eventName, data)，发给除自己的所有人</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">eventName</div>
				<div>事件名</div>
			</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">data</div>
				<div>发送数据</div>
			</div>
			<br>
			<div class="HelpBodyMiddle">toAll(eventName, data)，发给所有人，包括自己</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">eventName</div>
				<div>事件名</div>
			</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">data</div>
				<div>发送数据</div>
			</div>
			<div class="HelpBodyMiddle">joinRoom(roomName)，加入房间</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">roomName</div>
				<div>房间唯一标识</div>
			</div>
			<div class="HelpBodyMiddle">leaveRoom(roomName)，离开房间</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">roomName</div>
				<div>房间唯一标识</div>
			</div>
			<div class="HelpBodyMiddle">toRoom(roomName, eventName, sendData)，向指定房间发送消息，不包括自己</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">roomName</div>
				<div>房间唯一标识</div>
			</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">eventName</div>
				<div>事件名</div>
			</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">data</div>
				<div>发送数据</div>
			</div>
			<div class="HelpBodyMiddle">inRoom(roomName, eventName, sendData)，向指定房间发送消息，包括自己</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">roomName</div>
				<div>房间唯一标识</div>
			</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">eventName</div>
				<div>事件名</div>
			</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">data</div>
				<div>发送数据</div>
			</div>
			<div class="HelpBodyMiddle">disconnect()，主动断开Socket通信</div>
		</div>

		<br>
		<div>
			<div id="Backstage" class="HelpBodyBig">后端</div>
			<div class="HelpBodyMiddle">依赖“Base\server\controllers\Socket”模块，当网站启动时，会根据系统参数里面设置的SocketPort值开启Socket服务</div>
			<br>
			<div class="HelpBodyMiddle"><b>监听事件</b></div>
			<div class="HelpBodyMiddle">toSelf</div>
			<div class="HelpBodySmall">服务器监听到该事件之后，会将消息发给自己</div>
			<div class="HelpBodyMiddle">toOther</div>
			<div class="HelpBodySmall">服务器监听到该事件之后，发送除开自己的其他所有人</div>
			<div class="HelpBodyMiddle">toAll</div>
			<div class="HelpBodySmall">服务器监听到该事件之后，会将消息发给所有人，包括自己</div>
			<div class="HelpBodyMiddle">joinRoom</div>
			<div class="HelpBodySmall">服务器监听到该事件之后，会将该连接加入指定房间</div>
			<div class="HelpBodyMiddle">leaveRoom</div>
			<div class="HelpBodySmall">服务器监听到该事件之后，会将该连接移出该房间</div>
			<div class="HelpBodyMiddle">toRoom</div>
			<div class="HelpBodySmall">服务器监听到该事件之后，会向一个房间广播消息，发送者收不到消息</div>
			<div class="HelpBodyMiddle">inRoom</div>
			<div class="HelpBodySmall">服务器监听到该事件之后，会向一个房间广播消息，包括发送者都能收到消息</div>
			<div class="HelpBodyMiddle">clientDisconnect</div>
			<div class="HelpBodySmall">服务器监听到该事件之后，会将该连接断开</div>
			<div class="HelpBodyMiddle">error</div>
			<div class="HelpBodySmall">服务器监听到该事件之后，会断开该连接，并记录错误日志</div>
			<br>
			<div class="HelpBodyMiddle"><b>方法</b></div>
			<div class="HelpBodyMiddle">emitBySocketId(socketId, eventName, data)，发送给指定连接</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">socketId</div>
				<div>连接标识</div>
			</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">eventName</div>
				<div>事件名</div>
			</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">data</div>
				<div>发送数据</div>
			</div>
			<div class="HelpBodyMiddle">emit(eventName, data)，广播给所有人</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">eventName</div>
				<div>事件名</div>
			</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">data</div>
				<div>发送数据</div>
			</div>
			<div class="HelpBodyMiddle">emitRoom(eventName, roomName, data)，广播给该房间的所有人，包括自己</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">eventName</div>
				<div>事件名</div>
			</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">roomName</div>
				<div>房间唯一标识</div>
			</div>
			<div class="HelpBodySmall">
				<div class="HelpNotEmpty">data</div>
				<div>发送数据</div>
			</div>
		</div>
	</div>